<?php
require_once 'net/crashtoot/php/picasa/model/PicasaUser.class.php';

/**
 * Gestionnaire d'utilisateur Picasa.
 */
class PicasaUsersManager {

	private $picasaUsers = array ();

	public function addUser($username, $login, $password) {
		$this->picasaUsers[$username] = ModelFactory::createPicasaUser($username, $login, $password);
	}

	public function addUserConnect($username, $login, $password) {
		//echo "adding user : ".$username;
		$user = PicasaUser::createPicasaUser($username, $login, $password);
		$user->connect();

		$this->picasaUsers[$username] = $user;
	}

	public function getUsers() {
		return $this->picasaUsers;
	}

	public function getAlbums() {
		$albums = array ();
		foreach ($this->picasaUsers as $username => $picasaUser) {
			$albums[$username] = $picasaUser->getAlbums();
		}
		return $albums;
	}

	public function getUser($username) {
		return $this->picasaUsers[$username];
	}
}